# Maintainer: umarcor <unai.martinezcorral@ehu.eus>

_realname=serial-studio
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.8
pkgrel=1
pkgdesc="Serial Studio: Multi-purpose serial data visualization & processing program (mingw-w64)"
arch=('any')
url="https://github.com/Serial-Studio/Serial-Studio"
license=('MIT')
groups=("${MINGW_PACKAGE_PREFIX}-eda")
depends=("${MINGW_PACKAGE_PREFIX}-qt5")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-gcc"
  "${MINGW_PACKAGE_PREFIX}-cmake"
)

source=("${_realname}::https://codeload.github.com/${_realname}/${_realname}/tar.gz/v${pkgver}")
sha256sums=('b407df08d84eff5e3b3fc6d2b9f49f82db0e58e7df7b91ae9b279dd6984e7486')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir build
  cd build
  MSYS2_ARG_CONV_EXCL="PREFIX=" \
  qmake PREFIX="${MINGW_PREFIX}" ..
  make
}

check() {
  "${srcdir}/${_realname}-${pkgver}"/build/release/Serial-Studio.exe --help
}

package() {
  install -D -m 755 "${srcdir}/${_realname}-${pkgver}"/build/release/SerialStudio.exe "${pkgdir}${MINGW_PREFIX}"/bin/SerialStudio.exe
  install -D -m 644 "${srcdir}/${_realname}-${pkgver}"/LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"/LICENSE.md
}
